package com.huilian.iotbox.admin.wap.service.impl;

import com.huilian.iotbox.admin.wap.dao.ProductDao;
import com.huilian.iotbox.admin.wap.service.ProductService;
import com.huilian.iotbox.data.common.ServerResponse;
import com.huilian.iotbox.data.dto.ProductDto;
import com.huilian.iotbox.data.po.Product;
import com.huilian.iotbox.data.vo.ProductVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author xilin
 * @date 2023/3/7 18:08
 */
@Service
public class ProductServiceImpl implements ProductService {
    @Resource
    private ProductDao productDao;

    @Override
    public ServerResponse findDeviceGroupByProductId(ProductDto productDto) {
        List<ProductVo> list = productDao.findDeviceGroupByProductId(productDto);
        return ServerResponse.createBySuccess(list);
    }

    @Override
    public Product findByDeviceId(Integer deviceId) {
        return productDao.findByDeviceId(deviceId);
    }

    @Override
    public Product findOneProductByCondition(Product product) {
        return productDao.findOneProductByCondition(product);
    }
}
